package org.sol.tools.commands;

public class Argument {
	
	private static final String shortFlag = "-";
	private static final String longFlag = "--";
	private static final String longAssign = "=";
	
	private String shortForm;
	private String longForm;
	private String shortDescription;
	private String longDescription;
	
	private String value = null;
	
	public Argument(String shortForm, String shortDescription) {
		this.shortForm = shortForm;
		this.shortDescription = shortDescription;
	}

	public Argument(String shortForm, String shortDescription, String longForm, String longDescription) {
		this.shortForm = shortForm;
		this.shortDescription = shortDescription;
		this.longForm = longForm;
		this.longDescription = longDescription;
	}

	public String getShortForm() {
		return shortForm;
	}

	public void setShortForm(String shortForm) {
		this.shortForm = shortForm;
	}

	public String getLongForm() {
		return longForm;
	}

	public void setLongForm(String longForm) {
		this.longForm = longForm;
	}

	public String getShortDescription() {
		return shortDescription;
	}

	public void setShortDescription(String shortDescription) {
		this.shortDescription = shortDescription;
	}

	public String getLongDescription() {
		return longDescription;
	}

	public void setLongDescription(String longDescription) {
		this.longDescription = longDescription;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public String help() {
		StringBuilder string = new StringBuilder();
		if (shortForm != null) {
			string.append(String.format("\t%s%s\t%s\n", shortFlag, shortForm, shortDescription));
		}
		if (longForm != null) {
			string.append(String.format("\t%s%s\t%s=%s\n", longFlag, longForm, longAssign, longDescription));
		}
		return string.toString();
	}
	
}
